-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Let DataFrame.quantile() handle datetime #7093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Let DataFrame.quantile() handle datetime #7093
Conversation
@jreback I'm having trouble with a bit of this. With a DataFrame In [3]: df = DataFrame({'a': pd.to_datetime(['2010', '2011']), 'b': [0, 5]})
In [5]: df.dtypes
Out[5]:
a datetime64[ns]
b int64
dtype: object
In [6]: df.quantile(.5, numeric_only=False) For the implementation, I've got a function
What's to best way to get from these timestamps to viewing as |
just iterate over with iteritems() and concat the results apply has a lot of heuristics that u don't need |
Thanks. That's a lot better. |
quantiles = [[f(vals, x) for x in per] | ||
for (_, vals) in data.iteritems()] | ||
result = DataFrame(quantiles, index=data._info_axis, columns=q).T | ||
if len(is_dt_col) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you actually need the if (if its empty it just won't iterate over anything)...but no biggie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it out originally, but I hit an error somewhere, I can't remember exactly what.
Closes pandas-dev#6965 previously returned nonsense
no prob...this looks fine otherwise |
BUG: Let DataFrame.quantile() handle datetime
Closes #6965